home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: HTML
- Sub-category: Hyperlinks
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates how to create hyperlinks from an
- xml document. Also note that we are using the "Push" method
- to transform data from our xml document. The Push method is
- an approach where templates are used extensively. Using the
- "Push" method, we are essentially defining templates for
- each of our xml elements and "Pushing" our xml data towards
- it.
- ================================================================ -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" />
-
- <xsl:template match="/">
- <html>
- <head>
- <style type="text/css">
- H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
- TD {COLOR: darkblue; FONT-FAMILY: Arial}
- TR { background-color: beige; }
- BODY { background-color: beige; }
- </style>
- </head>
- <body>
- <span class="subhead">Creating Hyperlinks from xml (Using the Push method)</span>
- <br />
- <br />
- <xsl:value-of select="@url" />
- <xsl:apply-templates />
- </body>
- </html>
- </xsl:template>
-
- <xsl:template match="link">
- <span class="text">
- <b>Name:</b>
- <xsl:value-of select="@name" />
- <br />
- <b>Description:</b>
- <xsl:value-of select="@description" />
- <br />
- <b>URL:</b>
- <a href="{@url}">
- <xsl:value-of select="@url" />
- </a>
- <br />
- <br />
- </span>
- </xsl:template>
- </xsl:stylesheet>
-